package com.vf.admin.miaodong.service.impl;

import com.vf.admin.common.splitpage.SplitPageBean;
import com.vf.admin.miaodong.dao.AfterGiftRewardDao;
import com.vf.admin.miaodong.entity.AppGiftReward;
import com.vf.admin.miaodong.service.AfterGiftRewardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 礼物打赏记录
 */
@Service
public class AfterGiftRewardServiceImpl implements AfterGiftRewardService {

    @Autowired
    AfterGiftRewardDao afterGiftRewardDao;

    /**
     * 查询列表
     */
    @Override
    public List<AppGiftReward> list(Map<String, Object> paraMap, SplitPageBean splitPage) {
        return afterGiftRewardDao.list(paraMap, splitPage);
    }

    @Override
    public Double listSum(Map<String, Object> paraMap) {
        List<AppGiftReward> appGiftRewards = afterGiftRewardDao.listSum(paraMap);
        Double sum = appGiftRewards.stream().mapToDouble(e -> e.getMoney()).sum();
        return sum;
    }

    /**
     * 详情
     */
    @Override
    public AppGiftReward get(Integer id) {
        return afterGiftRewardDao.get(id);
    }

    /**
     * 添加/修改
     */
    @Override
    public void save(AppGiftReward haoYou) {
        afterGiftRewardDao.save(haoYou);
    }

    /**
     * 删除
     */
    @Override
    public void del(Integer id) {
        afterGiftRewardDao.del(id);
    }

    /**
     * 查询抽奖金额
     * @param parMap
     * @return
     */
    @Override
    public Long findListByInfo(Map<String, Object> parMap) {
        return afterGiftRewardDao.findListByInfo(parMap);
    }
}
